package org.ls.petclinic.dao.impl;

import org.ls.petclinic.dao.AccessDao;
import org.ls.petclinic.pojo.Access;

import java.util.List;

/**
 * @Description
 * @Author 浪矢先生
 * @Create 2022-06-11 19:28
 */
public class AccessDaoImpl extends BaseDao implements AccessDao {
    @Override
    public int add(Access access) {
        return update("insert into access(customerId,name,phone,time)values(?,?,?,?)", access.getCustomerId(),access.getName(),access.getPhone(),access.getTime());
    }

    @Override
    public Access getById(int id) {
        return queryForOne(Access.class, "select * from access where id=?",id);
    }

    @Override
    public int deleteById(int id) {
        return update("delete from access where id = ?",id);
    }

    @Override
    public List<Access> getAll() {
        return queryForList(Access.class, "select * from access");
    }
}
